package com.faner.fast.exception;

import com.faner.fast.constant.enums.CodeEnum;
import org.springframework.http.HttpStatus;

/**
 * 令牌无效异常
 * description: TokenInvalidException
 * date: 2020/11/20 16:27
 * author: faner
 */
public class TokenInvalidException extends HttpException{
    protected int code = CodeEnum.TOKEN_INVALID.getCode();

    protected int httpCode = HttpStatus.UNAUTHORIZED.value();

    public TokenInvalidException() {
        super(CodeEnum.TOKEN_INVALID.getCode(), CodeEnum.TOKEN_INVALID.getMessage());
    }

    public TokenInvalidException(String message) {
        super(message);
    }

    public TokenInvalidException(int code) {
        super(code, CodeEnum.TOKEN_INVALID.getMessage());
        this.code = code;
    }

    public TokenInvalidException(int code, String message) {
        super(code, message);
        this.code = code;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public int getHttpCode() {
        return httpCode;
    }
}
